﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MouseOverChild : MonoBehaviour 
{
    private GameObject mouseOverChild;

    void Start()
    {

    }

    public bool IsMouseOverChild()
    {
        foreach (Transform child in transform.FindChild("Teeth"))
        {
            if (   child.tag == "Target"
                && child.GetComponent<MouseOverScript>() != null
                && child.GetComponent<MouseOverScript>().IsMouseOver()
                && child.GetComponent<ToothScript>() != null
                && child.GetComponent<ToothScript>().IsOn)
            {
                mouseOverChild = child.gameObject;
                return true;
            }          
        }

        return false;
    }

    public GameObject MouseOverChildGO()
    {
        return mouseOverChild;
    }
}
